package com.ddapps.unitconversion;


import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class UnitConversionActivity extends ListActivity {
	
	public final static String EXTRA_MESSAGE = "com.ddapps.unitconversion.MESSAGE";
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);

	  String[] countries = getResources().getStringArray(R.array.countries_array);
	  setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, countries));

	}
	
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        // TODO: fill in rest of method
        super.onListItemClick(l, v, position, id);
        //String text = ((TextView) v).getText().toString();
        Intent i = new Intent(this, ConvertActivity.class); 
        int new_id = (int) id;
        i.putExtra(EXTRA_MESSAGE, new_id);
        startActivity(i);
    }
}